package com.atguigu.blog.dto.response;

import java.io.Serializable;

public class Result implements Serializable {
    private static final long serialVersionUID = 9218812351323900849L;
    private Integer status;
    private String msg;
    private Object data;

    public Result() {
    }

    public Result(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public Result(String msg, Object data) {
        this.status = 200;
        this.msg = msg;
        this.data = data;
    }

    public Result(Integer status, Object data) {
        this.status = status;
        this.data = data;
    }

    public static Result build(Integer status, String msg, Object data) {
        return new Result(status, msg, data);
    }

    public static Result ok(Object data) {
        return new Result("ok", data);
    }

    public static Result ok(String msg, Object data) {
        return new Result(msg, data);
    }

    public static Result ok() {
        return new Result("ok", (Object)null);
    }

    public static Result error(Object data) {
        return new Result(500, "error", data);
    }

    public static Result error(int code, Object msg) {
        return new Result(code, msg);
    }

    public static Result error(String msg) {
        return new Result(500, msg, (Object)null);
    }

    public static Result error() {
        return new Result(500, "error", (Object)null);
    }

    public Integer getStatus() {
        return this.status;
    }

    public String getMsg() {
        return this.msg;
    }

    public Object getData() {
        return this.data;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
